<template>
  <div class="">
    <el-tabs v-model="tabs">
      <el-tab-pane name="1" label="视频链接">
        <el-form size="medium" label-width="100px">
          <el-form-item :label="i == 0 ? '链接地址' : ''" v-for="(item, i) in selectlist" :key="i">
            <el-input style="width: 300px;" v-model="item.url"></el-input>
            <i v-if="selectlist.length>1&&i<selectlist.length-1" class="el-sc-cuo u-m-l-20" @click="dellist(i)"></i>
            <i v-else class="el-sc-tianjia6 u-m-l-20" @click="addlist"></i>
          </el-form-item>
        </el-form>
      </el-tab-pane>
    </el-tabs>
    <div class="dialog-footer">
      <el-button @click="outData(false)">取消</el-button>
      <el-button type="primary" @click="outData(true)">确定</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
      tabs: '1',
      selectlist: []
    };
  },
  props: {
    data: {
      type: Array,
      default: function() {
        return [];
      }
    }
  },
  mounted() {
    this.selectlist = JSON.parse(JSON.stringify(this.data));
    this.selectlist.push({url: ''});
  },
  methods: {
    addlist() {
      this.selectlist.push({url: ''});
    },
    dellist(i) {
      this.selectlist.splice(i, 1);
    },
    //确定选择数据
    outData(type) {
      if (type) {
        let list=this.selectlist.filter(_=>_.url!='')
        this.$emit('outData', list);
      } else {
        this.$emit('outData', false);
      }
    }
  }
};
</script>

<style></style>
